import java.util.Random;
import java.util.Scanner;//类似头文件

/**
 * Created with IntelliJ IDEA
 * Description:Learning
 * User:22954
 * Date:2024-01-01
 * Time:16:23
 */
public class Test {
    public static void main(String[] args) {
        int count1 = 0, count2 = 0;
        Random random=new Random();
        float p = 0.5F;
        int q = 5;
        for (int i = 0; i < 100000; i++) {
            if (Math.random() < p)
                count1++;
            if (random.nextInt(10)<5)
                count2++;
        }
        System.out.println("Math.random()生成数字小于0.5的概率为：" + (count1 / 100000.0));
        System.out.println("Random生成数字小于5的概率为：" + (count2 / 100000.0));
    }

    public static void main6(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNextInt()) {
            int a = in.nextInt();
            System.out.println(a);
        }
        while (in.hasNextLine()) {
            String b = in.nextLine();
            System.out.println(b);
        }
    }

    public static void main5(String[] args) {
        for (int i = 0; i <= 100; i++) {
            if (i % 5 != 0 || i % 3 != 0) {
                continue;
            }
            System.out.println(i);
        }
    }

    public static void main4(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        long ret = 0;
        for (int i = 1; i <= n; i++) {
            long tmp_ret = 1;
            for (int j = 1; j <= i; j++) {
                tmp_ret *= j;
            }
            ret += tmp_ret;
        }
        System.out.println(ret);
    }

    public static void main3(String[] args) {
        int sum1 = 0, sum2 = 0, sum3 = 0;
        for (int i = 0; i < 101; i++) {
            sum1 += i;
            if (i % 2 == 0) {
                sum3 += i;
            } else {
                sum2 += i;
            }
        }
        System.out.println(sum1);
        System.out.println(sum2);
        System.out.println(sum3);
    }

    public static void main2(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int year = scanner.nextInt();
        if (year % 4 == 0) {
            if (year % 400 == 0 || year % 100 != 0) {
                System.out.println(year + "是闰年");
            } else {
                System.out.println(year + "不是闰年");
            }
        } else {
            System.out.println(year + "不是闰年");
        }
    }

    public static void main1(String[] args) {
//      Sacnner-工具                 System.in-键盘
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        System.out.println(a);
//      ctrl+/ -> //      ctrl+shift+/ -> /**/
    }
}
